<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" width="80%" destroy-on-close @closed="$emit('closed')" top="10vh">
        <el-form :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" label-width="110px" label-position="right">
            <el-col :span="22">
                <sc-form-table ref="table" prop="process_data" v-model="form.process_data" :addTemplate="process" placeholder="暂无数据" hideAdd showIndex>
                    <el-table-column prop="process_id" label="SKC"></el-table-column>
                    <el-table-column prop="process_id" label="货号"></el-table-column>
                    <el-table-column prop="process_id" label="SKU"></el-table-column>
                    <el-table-column prop="type" label="属性集">
                        <template #default="scope">
                            <div v-for="(item,index) in scope.row.sizeCate.sample_clothing" :key="index">
                                <div>{{item}}</div>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column prop="remark" label="打印数量">
                        <template #default="scope">
                            <div v-for="(item,index) in scope.row.sizeCate.sample_clothing" :key="index">
                                <el-input v-model="item.num"></el-input>
                            </div>
                        </template>
                    </el-table-column>
                </sc-form-table>
            </el-col>
        </el-form>
		<template #footer>
			<el-button @click="visible = false">取 消</el-button>
			<el-button v-if="mode != 'show'" type="primary" :loading="isSaveing" @click="submit()">打印</el-button>
		</template>
	</el-dialog>
</template>

<script>
export default {
	emits: ['success', 'closed'],
	data() {
		return {
			mode: "gong",
			titleMap: {
				gong: '你将打印以下订单的条码',
				edit: '编辑商品',
				show: '查看'
			},
            dialog: {
				save: false
			},
			visible: false,
			//表单数据
			form: {
                process_data:[{
                    sample_clothing:[],
                }]
			},
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open(mode = 'gong') {
			this.mode = mode;
			this.visible = true;
			return this
		},
		//表单提交方法
		submit() {
            this.$emit('success',this.mode)
            this.visible = false;
		},
		//表单注入数据
		setData(data) {
			console.log('data :>> ', data);
            this.form.process_data = data
		},
	}
}
</script>

<style></style>
